using Microsoft.SemanticKernel;
using Microsoft.Extensions.DependencyInjection;
using System.Diagnostics.CodeAnalysis;

public class OpenAIRegister:AiProviderRegister
{
    public override EnumAiProviderType AiProviderType=>EnumAiProviderType.OpenAI;

    protected override void RegisterChatCompletionService(IKernelBuilder builder, IServiceProvider provider,AiProvider aiProvider)
    {
        var modelId = aiProvider.GetChatCompletionApiService()?.ModelId;
        if(string.IsNullOrWhiteSpace(modelId))
        {
            return;
        }

        builder.AddOpenAIChatCompletion(modelId,aiProvider.ApiKey);
    }

    [Experimental("SKEXP0010")]
    protected override void RegisterEmbeddingService(IKernelBuilder builder,IServiceProvider provider,AiProvider aiProvider)
    {
        var modelId=aiProvider.GetChatCompletionApiService()?.ModelId;
        if(string.IsNullOrWhiteSpace(modelId))
        {
            return;
        }
        builder.AddOpenAIEmbeddingGenerator(modelId,aiProvider.ApiKey);
    }
}